package com.learn.service.second.api.impl;

import java.util.Arrays;
import java.util.Map;


import com.learn.service.second.api.ErShopMapper;
import com.learn.service.second.pojo.ErShopEntity;
import com.learn.service.second.utils.PageUtils;
import com.learn.service.second.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;




/**
 * 
 *
 * @author sjf
 * @email 2334593702@qq.com
 * @date 2020-08-14 17:47:02
 */
@RestController
@RequestMapping("api/ershop")
public class ErShopController {
    @Autowired
    private ErShopMapper erShopMapper;

    /**
     * 列表
     */
    @RequestMapping("/list")
  //  @RequiresPermissions("api:ershop:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = erShopMapper.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{shId}")
   // @RequiresPermissions("api:ershop:info")
    public R info(@PathVariable("shId") Integer shId){
		ErShopEntity erShop = erShopMapper.selectById(shId);

        return R.ok().put("erShop", erShop);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("api:ershop:save")
    public R save(@RequestBody ErShopEntity erShop){
		erShopMapper.insert(erShop);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("api:ershop:update")
    public R update(@RequestBody ErShopEntity erShop){
		erShopMapper.updateById(erShop);

        return R.ok();
    }

    /**
     * 删除
     */
//    @RequestMapping("/delete")
//    //@RequiresPermissions("api:ershop:delete")
//    public R delete(@RequestBody Integer[] shIds){
//		erShopMapper.removeByIds(Arrays.asList(shIds));
//
//        return R.ok();
//    }

}
